

package Animation;

import javax.media.opengl.GL;


public class Circle   {

    final double DEG2RAD = Math.PI/180; // simplified 2 * pi * r
    int centerX;
    int centerY;
    float radius;
    double[] color;


    public Circle()
    {
        centerX = 0;
        centerY = 0;
        radius = 0;
    }

    public void drawCircle(GL gl, int x, int y, float rad)
    {
       centerX = x;
       centerY = y;
       radius = rad;


       gl.glBegin(GL.GL_POLYGON);
       gl.glColor3dv(color, 0);
       for (int i = 0; i <= 360; i++)
       {
           float radians = new Float(i *DEG2RAD);
           float cosRad = new Float(Math.cos(radians)) ;
           float sinRad = new Float(Math.sin(radians)) ;
           gl.glVertex3d(cosRad*radius + centerX, sinRad*radius + centerY, 1);
       }
       gl.glEnd();
    }

}
